package com.yoyo.yyadsdk.config;

import android.util.SparseArray;

import com.yoyo.yyadsdk.bean.AnlTimeEntity;
import com.yoyo.yyadsdk.bean.dao.ConfigEntity;
import com.yoyo.yyadsdk.util.GreenDaoManager;
import com.yoyo.yyadsdk.util.TimeUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class Constants {
    public static final String HOST = "";
    public static final String SUCCESS = "1000";

    public static final int MEDIA_ID = 6;

    public static final String SOURCE_FLAG = "source";
    public static final int SOURCE_BOOT = 1;
    private static ConfigEntity configEntity;
    public static boolean ENABLED_STATUS = false;

    public static final int LOCK = 34;
    public static final int INTERACTION = 37;
    public static final int APP_INTERACTION = 38;
    public static final int ICON_UP = 39;
    public static final int ICON_DOWN = 40;
    public static final int BANNER_UP = 35;
    public static final int BANNER_DOWN = 36;
    public static final int LOCK_BIG = 42;
    //    public static final int LOCK_BIG_ = 43;
//    public static final int LOCK_BIG_ = 44;
    public static final int LOCK_BIG_ = 45;

    public static final int TYPE_NATIVE = 0;
    public static final int TYPE_MOULD = 1;

    public static SparseArray<AnlTimeEntity> mWebStatusTimes = new SparseArray<>();

    public static ConfigEntity getConfigEntity() {
        if (configEntity == null) {
            List<ConfigEntity> configEntities = GreenDaoManager.getInstance().getDaoSession().getConfigEntityDao().loadAll();
            if (configEntities != null && configEntities.size() > 0) {
                configEntity = configEntities.get(0);
            }
        }
        return configEntity;
    }

    public static long getGetInterval() {
        configEntity = getConfigEntity();
        return configEntity == null ? TimeUtils.DAY : (configEntity.getGetInterval() * TimeUtils.SECOND);
    }

    public static void setConfigEntity(ConfigEntity configEntity) {
        Constants.configEntity = configEntity;
    }
}
